package se.jocke.nbrs.model;

import com.google.common.collect.HashBiMap;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author jocke
 */
public class RestServiceResponse {

    private String contentType;

    private String body;

    private int responseCode;

    private String responseLine;

    private Map<String, String> headers;
    
    private Map<String, String> cookies;

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public int getResponseCode() {
        return responseCode;
    }

    public void setResponseCode(int responseCode) {
        this.responseCode = responseCode;
    }

    public String getResponseLine() {
        return responseLine;
    }

    public void setResponseLine(String responseLine) {
        this.responseLine = responseLine;
    }

    public Map<String, String> getHeaders() {
        return Collections.unmodifiableMap(headers);
    }

    public void setHeaders(Map<String, String> headers) {
        this.headers = new HashMap<String, String>(headers);
    }

    public Map<String, String> getCookies() {
        return Collections.unmodifiableMap(cookies);
    }

    public void setCookies(Map<String, String> cookies) {
        this.cookies = new HashMap<String,String>(cookies);
    }
    
    
    @Override
    public int hashCode() {
        int hash = 7;
        hash = 59 * hash + (this.body != null ? this.body.hashCode() : 0);
        hash = 59 * hash + this.responseCode;
        hash = 59 * hash + (this.responseLine != null ? this.responseLine.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final RestServiceResponse other = (RestServiceResponse) obj;
        if ((this.body == null) ? (other.body != null) : !this.body.equals(other.body)) {
            return false;
        }
        if (this.responseCode != other.responseCode) {
            return false;
        }
        if ((this.responseLine == null) ? (other.responseLine != null) : !this.responseLine.equals(other.responseLine)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "RestServiceResponse{" + "body=" + body + ", responseCode=" + responseCode + ", responseLine=" + responseLine + '}';
    }

}
